from appium.webdriver.common.mobileby import MobileBy
from selenium.webdriver.support.wait import WebDriverWait
from app_wechat_po.base.base_page import BasePage


class AddMemberPage(BasePage):
    def goto_edit_menber(self):
        # 3.点击【手动输入添加】
        self.find_and_click(MobileBy.ID, "com.tencent.wework:id/che")

        from app_wechat_po.page.edit_member_page import EditMemberPage
        return EditMemberPage(self.driver)

    # 获取文本信息 添加成功
    def get_text(self):
        result = self.get_toast_text()
        return result

    # 6.验证结果，删除是否成功,等待元素消失
    def get_del_text(self):
        del_contact_locator = (MobileBy.XPATH, "//*[@text='联系人']/../following-sibling::*//*[@text='{del_contactname}']")
        self.wait_disappear(del_contact_locator)
        return del_contact_locator